package com.example.jpademo;

import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;

/**
 * @Data lombok annotion  getter/setter
 * @Entity  entity class
 * @Table map a table in database
 */
@Data
@Entity
@Table(name="tb_user")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
public class User {
    @Id
    @GeneratedValue(generator = "jpa-uuid")
    private String id;

    @Column(name = "name")
    @NotEmpty(message="please provide a name")
    private String name;

    @Column(name = "age")
    @Min(10)
    @Max(35)
    private int age;


}
